import dotenv from 'dotenv';
dotenv.config();

const config = {
  development: {
    host: process.env.DB_HOST || '171.80.4.29',  // 修改为连接远程数据库
    port: parseInt(process.env.DB_PORT) || 58306,   // 修改端口
    user: process.env.DB_USER || 'root',
    password: process.env.DB_PASSWORD || 'mysql_H8HDSy', // 修改密码
    database: process.env.DB_NAME || 'blog-new',    // 修改数据库名
    charset: 'utf8mb4',
    timezone: '+08:00',
    acquireTimeout: 60000,
    connectionLimit: 10
  },

  production: {
    host: process.env.PROD_DB_HOST || '171.80.4.29',
    port: parseInt(process.env.DB_PORT) || 58306,
    user: process.env.PROD_DB_USER || 'root',
    password: process.env.PROD_DB_PASSWORD || 'mysql_H8HDSy',
    database: process.env.DB_NAME || 'blog-new',
    charset: 'utf8mb4',
    timezone: '+08:00',
    connectionLimit: 10
  }
};

const env = process.env.NODE_ENV || 'development';
export default config[env];